﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PQT.API;
using PQT.API.File;
using PQT.API.DataDefine.Sys;
using PQT.Common;
using cbmobile.BLC;
using cbmobile.DAC;

namespace cbmobile.MasterUser.UC_user
{
    public partial class News_Detail : System.Web.UI.UserControl
    {
        BLC_TinTuc nBLC = new BLC_TinTuc();
        CBMobileEntities da = new CBMobileEntities();
        int pageSize = 10;

        protected void Page_Load(object sender, EventArgs e)
        {
            BindNewsInfo();
            BindNews();
        }

        private int IDNews
        {
            get
            {
                if (Request.QueryString["id"] != null)
                    return Convert.ToInt32(Request.QueryString["id"]);
                return -1;
            }
        }

        private void BindNewsInfo()
        {
            TinTuc ent1 = nBLC.Get_News_By_ID(this.IDNews);
            if (ent1 != null)
            {
                lblTitle.Text = ent1.TieuDe;
                lblSubContent.Text = ent1.MoTaNgan.Replace("\r\n", "<br/>");
                ltrContent.Text = ent1.NoiDung;
            }
        }


        private void BindNews()
        {
            DataTable dt = nBLC.Get_Top_News();
            ddlNews.DataSource = dt;
            ddlNews.DataBind();
        }
    }
}